// Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

#include "GameFeatureAction_WorldActionBase.h"
#include "UObject/ObjectKey.h"

#include "GameFeatureAction_SplitscreenConfig.generated.h"

class UObject;
struct FGameFeatureDeactivatingContext;
struct FGameFeatureStateChangeContext;
struct FWorldContext;

//////////////////////////////////////////////////////////////////////
// UGameFeatureAction_SplitscreenConfig

/**
 * 负责配置分屏的GameFeatureAction
 */
UCLASS(MinimalAPI, meta = (DisplayName = "Splitscreen Config"))
class UGameFeatureAction_SplitscreenConfig final : public UGameFeatureAction_WorldActionBase
{
	GENERATED_BODY()

public:
	//~ 开始 UGameFeatureAction 接口
	virtual void OnGameFeatureDeactivating(FGameFeatureDeactivatingContext& Context) override; // 游戏特性停用时调用
	//~ 结束 UGameFeatureAction 接口

	//~ 开始 UGameFeatureAction_WorldActionBase 接口
	virtual void AddToWorld(const FWorldContext& WorldContext, const FGameFeatureStateChangeContext& ChangeContext) override; // 添加到世界
	//~ 结束 UGameFeatureAction_WorldActionBase 接口

public:
	UPROPERTY(EditAnywhere, Category=Action)
	bool bDisableSplitscreen = true; // 是否禁用分屏

private:
	TArray<FObjectKey> LocalDisableVotes; // 本地禁用投票列表

	static TMap<FObjectKey, int32> GlobalDisableVotes; // 全局禁用投票映射
};